<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center customerService_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub customerService_fd0_0'>
          <view class='flex flex-wrap align-center customerService_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  customerService_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='customerService_fd0_0_c1_c0' v-if=" publisher_type==''">{{$t('客服中心')}}</text><text
              class='customerService_fd0_0_c1_c0' v-else>{{$t('立即咨询')}}</text>
          </view>
          <view class='flex flex-wrap align-center justify-end customerService_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout" v-if="publisher_type">
        <view class='flex flex-wrap align-center justify-center customerService_fd1_0'>
          <image class='customerService_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"38.png"'></image>
        </view>
        <view class='flex flex-direction flex-wrap align-center customerService_fd1_1' v-if="data.mobile">
          <text class='customerService_fd1_1_c0'>{{data.mobile}}</text>
          <text class='customerService_fd1_1_c1'>{{$t('客服电话')}}</text>
          <button class='customerService_fd1_1_c2' @tap.stop="openPop(data.mobile,1)">{{$t('拨打电话')}}</button>
        </view>
        <view class='flex flex-wrap align-center customerService_fd1_2' v-if="data.wechat">
          <image class='customerService_fd1_2_c0' mode="aspectFit" :src='STATIC_URL+"39.png"'></image>
          <text class='customerService_fd1_2_c1'>{{data.wechat}}</text>
          <button class='customerService_fd1_2_c2' @tap.stop="openPop(data.wechat,2)">{{$t('复制')}}</button>
        </view>
        <view class='flex flex-wrap align-center customerService_fd1_3' v-if="data.whatsapp_url">
          <image class='customerService_fd1_2_c0' mode="aspectFit" :src='STATIC_URL+"40.png"'></image>
          <text class='customerService_fd1_2_c1'>{{data.whatsapp}}</text>
          <button class='customerService_fd1_2_c2' @tap.stop="openPop(data.whatsapp_url,3)">{{$t('打开')}}</button>
        </view>
        <view class='flex flex-wrap align-center customerService_fd1_3' v-if="data.facebook">
          <image class='customerService_fd1_2_c0' mode="aspectFit" :src='STATIC_URL+"Facebook.png"'></image>
          <text class='customerService_fd1_2_c1'>Facebook</text>
          <button class='customerService_fd1_2_c2' @tap.stop="openPop(data.facebook,4)">{{$t('打开')}}</button>
        </view>
      </view>
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout" v-else>
        <view class='flex flex-wrap align-center justify-center customerService_fd1_0'>
          <image class='customerService_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"38.png"'></image>
        </view>
        <view class='flex flex-direction flex-wrap align-center customerService_fd1_1' v-if="data.tel">
          <text class='customerService_fd1_1_c0'>{{data.tel}}</text>
          <text class='customerService_fd1_1_c1'>{{$t('客服电话')}}</text>
          <button class='customerService_fd1_1_c2' @tap.stop="callPhone(data.tel)">{{$t('拨打电话')}}</button>
        </view>
        <view class='flex flex-wrap align-center customerService_fd1_2' v-if="data.wechat">
          <image class='customerService_fd1_2_c0' mode="aspectFit" :src='STATIC_URL+"39.png"'></image>
          <text class='customerService_fd1_2_c1'>{{data.wechat}}</text>
          <button class='customerService_fd1_2_c2' @tap.stop="Copytext(data.wechat)">{{$t('复制')}}</button>
        </view>
        <view class='flex flex-wrap align-center customerService_fd1_3' v-if="data.whatsapp_url">
          <image class='customerService_fd1_2_c0' mode="aspectFit" :src='STATIC_URL+"40.png"'></image>
          <text class='customerService_fd1_2_c1'>{{data.whatsapp}}</text>
          <button class='customerService_fd1_2_c2' @tap.stop="gowebUrl(data.whatsapp_url)">{{$t('打开')}}</button>
        </view>
        <view class='flex flex-wrap align-center customerService_fd1_3' v-if="data.facebook">
          <image class='customerService_fd1_2_c0' mode="aspectFit" :src='STATIC_URL+"40.png"'></image>
          <text class='customerService_fd1_2_c1'>{{data.facebook}}</text>
          <button class='customerService_fd1_2_c2' @tap.stop="gowebUrl(data.facebook)">{{$t('打开')}}</button>
        </view>
      </view>
      <!---flex布局flex布局结束-->


    </view>
    <benben-popup v-model="popupShow1679541357000" :mask="true" :mask-close-able="true" mode='center'>
      <!---清除缓存flex布局开始-->
      <view class="flex flex-direction flex-wrap align-center system_flex_5">
        <!-- <view class='system_fd5_0'>騙案出沒注意</view> -->
        <jyf-parser :html="data.fraud_alert | richTextFormat"></jyf-parser>
        <view class='flex align-center system_fd5_2'>
          <!-- <button class='system_fd5_2_c0' @tap.stop="popupShow1679541357000=false">{{$t('取消')}}</button> -->
          <button class='system_fd5_2_c1' @tap.stop="callMobilePhone()">{{$t('明白')}}</button>
        </view>
      </view>

      <!---清除缓存flex布局结束-->

    </benben-popup>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},


    data() {
      return {
        popupShow1679541357000: false,
        "data": {
          mobile: '',
          wechat: '',
          whatsapp: '',
          whatsapp_url: ''
        },
        "publisher_type": "",
        aid: '',
        type: '',
        mobile: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        type,
        aid
      } = options
      if (type !== undefined) this.publisher_type = type
      if (aid !== undefined) this.aid = aid

      if (this.publisher_type) {
        this.getData()
      } else {
        this.getFoundationFunc()
      }

    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      openPop(mobile, type) {
        this.mobile = mobile
        this.type = type
        this.popupShow1679541357000 = true
      },
      callMobilePhone(mobile, type) {
        let that = this
        that.$api.post(global.apiUrls.post653a3ddc04145, {
          house_id: that.aid,
          contact_type: that.type,
          publisher_type: that.publisher_type
        }).then(res => {
          this.popupShow1679541357000 = false
          if (res.data.code == 1) {
            if (that.type == 1) {
              uni.makePhoneCall({
                phoneNumber: that.mobile
              })

            } else if (that.type == 2) {
              uni.setClipboardData({
                data: that.mobile,
                success: () => {
                  that.$message.success(this.$t('复制成功'))
                }
              });
            } else {
              // #ifdef APP || APP-PLUS || APP-NVUE
              console.log('oooo')
              uni.navigateTo({
                url: `/pages/benben-built-in/web-view/web-view?webPath=${that.mobile}`
              })
              // #endif
              // #ifdef H5
              console.log('1111')
              location.href = that.mobile
              // #endif
            }
          }
        })
      },
      callPhone(mobile) {
        uni.makePhoneCall({
          phoneNumber: mobile
        })
      },
      Copytext(text) {
        let that = this
        uni.setClipboardData({
          data: text,
          success: () => {
            that.$message.success(this.$t('复制成功'))
          }
        });
      },
      gowebUrl(url) {
        // #ifdef APP || APP-PLUS || APP-NVUE
        uni.navigateTo({
          url: `/pages/benben-built-in/web-view/web-view?webPath=${url}`
        })
        // #endif
        // #ifdef H5
        window.location.href = url
        // #endif
      },
      async getData() { //查询你咨询电话

        let datadata = await this.$api.post(global.apiUrls.post65600713d3e54, {
          publisher_type: this.publisher_type,
          aid: this.aid
        });

        if (datadata.data.code != 1) {
          this.$message.info(datadata.data.msg);
          return
        }
        let infodata = datadata.data;
        this.data = infodata.data
      },
      //获取基础信息
      async getFoundationFunc() {
        //请求方法
        //数据验证

        let datadata = await this.$api.post(global.apiUrls.post6551c36238685, {

        });

        if (datadata.data.code != 1) {
          this.$message.info(datadata.data.msg);
          return
        }
        let infodata = datadata.data;
        this.data = infodata.data

      }
    }
  };
</script>
<style lang="scss" scoped>
  .system_flex_5 {
    background: #fff;
    width: 540rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    padding: 24rpx 24rpx 41rpx 24rpx;
  }

  .system_fd5_1 {
    line-height: 42rpx;
    font-size: 28rpx;
    font-weight: 400;
    color: #666666;
  }

  .system_fd5_2_c1 {
    background: rgba(1, 129, 255, 1);
    border-radius: 36rpx;
    font-size: 28rpx;
    color: rgba(255, 255, 255, 1);
    width: 176rpx;
    height: 72rpx;
    margin: 0rpx 0rpx 0rpx 20rpx;
  }

  .system_fd5_2_c0 {
    background: rgba(248, 248, 248, 1);
    border-radius: 36rpx;
    font-size: 32rpx;
    color: rgba(51, 51, 51, 1);
    width: 176rpx;
    height: 72rpx;
    margin: 0rpx 20rpx 0rpx 0rpx;
  }

  .system_fd5_2 {
    margin: 32rpx 0rpx 0rpx 0rpx;
  }

  .system_fd5_0 {
    font-size: 36rpx;
    font-weight: 800;
    line-height: 44rpx;
    color: #333333;
    margin: 48rpx 0rpx 32rpx 0rpx;
  }

  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto;
  }

  .customerService_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .customerService_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333;
    line-height: 88rpx;
  }

  .customerService_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .customerService_fd0_0_c0 {
    width: 120rpx;
  }

  .customerService_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .customerService_fd1_3 {
    background: rgba(248, 248, 248, 1);
    margin: 24rpx 48rpx 0rpx 48rpx;
    border-radius: 16rpx;
    background-size: 100% auto;
    padding: 20rpx 32rpx 20rpx 32rpx;
  }

  .customerService_fd1_2_c2 {
    background: rgba(1, 129, 255, 0.1);
    border-radius: 33rpx 33rpx 33rpx 33rpx;
    width: 120rpx;
    line-height: 56rpx;
    font-size: 28rpx;
    color: rgba(1, 129, 255, 1);
    margin: 0rpx 0rpx 0rpx auto;
  }

  .customerService_fd1_2_c1 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 41rpx;
  }

  .customerService_fd1_2_c0 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .customerService_fd1_2 {
    background: rgba(248, 248, 248, 1);
    margin: 48rpx 48rpx 0rpx 48rpx;
    border-radius: 16rpx;
    background-size: 100% auto;
    padding: 20rpx 32rpx 20rpx 32rpx;
  }

  .customerService_fd1_1_c2 {
    background: rgba(1, 129, 255, 1);
    border-radius: 44rpx;
    width: 418rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    color: #fff;
    margin: 48rpx 0rpx 0rpx 0rpx;
  }

  .customerService_fd1_1_c1 {
    color: #999999;
    font-size: 26rpx;
    font-weight: 400;
    line-height: 41rpx;
    margin: 8rpx 0rpx 0rpx 0rpx;
  }

  .customerService_fd1_1_c0 {
    color: #0181FF;
    font-size: 48rpx;
    font-weight: 700;
    line-height: 52rpx;
  }

  .customerService_fd1_1 {
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .customerService_fd1_0_c0 {
    width: 334rpx;
    height: 334rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .customerService_fd1_0 {
    margin: 40rpx 0rpx 0rpx 0rpx;
  }
</style>
